<script language="javascript">
	function back(){
		document.location="<?php echo site_url(); ?>/aktifitas";
	}
</script>
<?php
echo form_open_multipart("/aktifitas/form_aktifitas/".$parameter, array("name"=>"form_aktifitas","id"=>"medic_form"));
if($parameter == FALSE){
	$mahasiswa	= set_value("mahasiswa");
	$nama		= set_value("nama");
	$ket		= set_value("ket");
	$jenis		= set_value("jenis");
} else {
	$mahasiswa	= $value["ID_MAHASISWA"];
	$nama		= $value["NAMA_KEGIATAN"];
	$ket		= $value["KETERANGAN"];
	$jenis		= $value["JENIS"];
}
?>
<p id="role" <?php echo ($this->session->userdata("id_role") == 1) ? ("") : ("style=\"display:none;\""); ?>>
	<label>Pilih Mahasiswa</label>
	<select name="mahasiswa">
		<option value="">-- Pilih Mahasiswa --</option>
		<?php
		foreach($q_mahasiswa as $row){
		?>
		<option value="<?php echo $row["ID_MAHASISWA"]; ?>" <?php echo ($mahasiswa == $row["ID_MAHASISWA"]) ? ("selected") : (""); ?>><?php echo $row["NAMA"]; ?></option>
		<?php
		}
		?>
	</select>
	<?php echo form_error("mahasiswa"); ?>
</p>

<p>
	<label>Nama Kegiatan</label>
	<input type="text" name="nama" value="<?php echo $nama; ?>">
	<?php echo form_error("nama"); ?>
</p>
<p>
	<label>Keterangan</label>
	<textarea name="ket"><?php echo $ket; ?></textarea>
	<?php echo form_error("ket"); ?>
</p>
<p>
	<label>Jenis</label>
	<select name="jenis" onChange="show(this)">
		<option value="">-- Pilih Jenis --</option>
		<option value="1" <?php echo ($jenis == 1) ? ("selected") : (""); ?>>Prestasi</option>
		<option value="2" <?php echo ($jenis == 2) ? ("selected") : (""); ?>>Aktifitas Kemahasiswaan</option>
	</select>
	<?php echo form_error("jenis"); ?>
</p>
<p id="bukti" style="<?php echo ($jenis == 1) ? ("display:block;") : ("display:none;"); ?>">
	<label>Bukti Sertifikat</label>
	<input type="file" name="userfile">
	<?php echo form_error("userfile"); ?>
</p>
<p>
	<input type="submit" class="btn btn-primary" id="submit" value="Simpan">
	<input type="reset" class="btn btn-primary" id="submit" value="Reset">
	<input type="button" class="btn btn-primary" id="submit" value="Kembali" onClick="back()">
</p>
<?php echo form_close(); ?>
<script language="javascript">
function show(operand){
	if(operand.options[operand.selectedIndex].value == "1"){
		document.getElementById("bukti").style.display="block";
	}else{
		document.getElementById("bukti").style.display="none";
	}
}
</script>